#ifndef REGISTRY_OUTPUT_OUTPUT_H
#define REGISTRY_OUTPUT_OUTPUT_H
//******************************************************************************
//*this code is protected by the GNU affero GPLv3
//*author:Sylvain BERTRAND <sylvain.bertrand AT gmail dot com>
//*                        <digital.ragnarok AT gmail dot com>
//******************************************************************************
//XXX:Static allocation of registry objects may waste way too much memory
//when based on an union. May change the data model later, with a dynamic array
//of outputs and a reference index in the registry object, detail.

//the following limits are based on the edid standard
#define OUTPUT_MANUFACTURER_SZ_MAX 3
#define OUTPUT_PRODUCT_CODE_SZ_MAX 5
#define OUTPUT_MONITOR_NAME_SZ_MAX 13
#define OUTPUT_MONITOR_SERIAL_SZ_MAX 13
struct output{
  struct udev_device *d;//we have a ref on it, 0 means the output is gone
  u8 blk_idx;
  i fd;
  s32 x;
  s32 y;

  struct si_dce_dps_info dce_info;
  u64 discret_vram_sz;
  struct alga_timing *current;
  u8 pixel_fmt;
  struct si_mem fb;
  u8 manufacturer[OUTPUT_MANUFACTURER_SZ_MAX+1];//with the 0 terminating char
  u8 product_code[OUTPUT_PRODUCT_CODE_SZ_MAX+1];//idem
  u8 monitor_name[OUTPUT_MONITOR_NAME_SZ_MAX+1];//idem
  u8 monitor_serial[OUTPUT_MONITOR_SERIAL_SZ_MAX+1];//idem
};
struct gbl *output_plugged(struct udev_device *d);
struct gbl *output_gone(struct udev_device *d);
void outputs_cleanup_force(void);

u8 v_refresh(struct alga_timing *timing);
#endif
